﻿using System.Windows;
using System.Windows.Controls.Primitives;

namespace Sparkle.MVVM.ActionResults
{
    public class PopupDialogActionResult:ActionResult
    {
        public PopupDialogActionResult(string viewName, object dataContext)
            : base(viewName, dataContext)
        {
        }

        public override void Execute()
        {
            if (Defaults.Shell == null || Defaults.Shell.Popup == null) return;

            var popup = Defaults.Shell.Popup;
            var control = GetView(ViewName);
            popup.SetDialogContent(control,null);
            popup.Show();
        }

    }
}